import * as types from '../mutation-types.js'
import apiurl from '@/api/apiurl'
// import Api from '@/api/index'

//全局状态
const state = {

}

//getters
const getters = {

}

const mutations = {

}

const actions = {
  /**
   * 获取离线gps数据
   * @param params{ privateKey: 私钥, dishLocation: 网盘路径地址, account: 当前账号 }
   * @returns { status: 1, result: [{address, createTime, latitude, longitude}], message: '请求成功' }
   */
  async fetchOfflineGPS(_, params = {}) {
    // console.log(params,'获取离线gps数据参数')
    // console.log(apiurl.offlineQueryGpsData)
    // let res = {
    //   status: 1,
    //   result: [
    //     {
    //       address: '福建省厦门市湖里区禾山街道云顶北路湖里创新园1',
    //       createTime: 1634021539,
    //       latitude: 24.52922630,
    //       longitude: 118.15385437
    //     },
    //     {
    //       address: '福建省厦门市湖里区禾山街道云顶北路湖里创新园2',
    //       createTime: 1634021538,
    //       latitude: 26.52922630,
    //       longitude: 120.15385437
    //     },
    //     {
    //       address: '福建省厦门市湖里区禾山街道云顶北路湖里创新园3',
    //       createTime: 1634021536,
    //       latitude: 25.52922630,
    //       longitude: 119.15385437
    //     }
    //   ],
    //   message: '请求成功'
    // }
    let res = await Api.request(apiurl.offlineQueryGpsData, {
      ...params
    })
    return res
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  getters,
  actions
}
